﻿#include "TestPluginActivator.h"
#include "TestPluginService.h"

#include "CPF/CPFRegisterService.h"

TestPluginActivator::TestPluginActivator()
    : m_pService(nullptr)
{
    // Activator构造函数:必须添加的宏 -- 4
    CPF_SET_INSTANCE(&cpf_create_instance);
}

TestPluginActivator::~TestPluginActivator()
{

}

bool TestPluginActivator::start(void)
{
    m_pService = new TestPluginService();

    CPFRegisterService::instance()->registerObject<TestPluginService>(m_pService);

    return true;
}

bool TestPluginActivator::stop(void)
{
    const type_info& info = typeid(TestPluginService);
    CPFRegisterService::instance()->unregisterObject(info.name());

    delete m_pService;
    m_pService = nullptr;

    return true;
}

std::string TestPluginActivator::name(void)
{
    return "TestPluginActivator";
}

std::string TestPluginActivator::version(void)
{
    return "TestPluginActivator V1.0.0.0";
}
